﻿use persons
go
------------------2----------------------------------------------------------------
/*Find contacts all people with name Ivan*/
DECLARE  @M_NAME NVARCHAR(50)
SET @M_NAME=N'Ivan'

SELECT 
[Person].[FirstName], 
[Person].[LastName], 
[Contact].[ContactType], 
[Contact].[ContactValue]
FROM [dbo].[Contact], [dbo].[Person] 
WHERE [Person].[ID]=[Contact].[fk_personId] AND [Person].[FirstName]=@M_NAME

SELECT 
[Person].[FirstName], 
[Person].[LastName],
[Contact].[ContactType], 
[Contact].[ContactValue]
FROM [dbo].[Contact] INNER JOIN [dbo].[Person] ON [Person].[ID]=[Contact].[fk_personId]
WHERE [Person].[FirstName]=@M_NAME
